package com.study.demo01.consumer;

import com.rabbitmq.client.Channel;
import com.study.demo01.config.DelayedExchangeConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 基于插件的延迟
 */
@Slf4j
@Component
public class DelayeQueueConsumer {

    @RabbitListener(queues = DelayedExchangeConfig.delayed_queue_name)
    public void consumer(Message message, Channel channel) {
        log.info("接收到延迟队列消息[{}-{}]", new String(message.getBody()));
    }
}
